package javaClassExercise;

import java.util.Calendar;

/**
 * Created by lomo.
 */
public class Time {
    public Time() {}

    Calendar calendar = Calendar.getInstance();

    //int hour = calendar.get(Calendar.HOUR);  //12
    int hour = calendar.get(Calendar.HOUR_OF_DAY); //24
    int minutes = calendar.get(Calendar.MINUTE);
    int seconds = calendar.get(Calendar.SECOND);

    public int getHour() {
        return hour;
    }

    public void setHour(int hour) {
        this.hour = hour;
    }

    public int getMinutes() {
        return minutes;
    }

    public void setMinutes(int minutes) {
        this.minutes = minutes;
    }

    public int getSeconds() {
        return seconds;
    }

    public void setSeconds(int seconds) {
        this.seconds = seconds;
    }

    public void printCurrentTime() {
        System.out.println("Current Time is: " + getHour() + "时" + getMinutes() + "分" + getSeconds() + "秒");
    }
    public static void main(String... args){
        Time time = new Time();
        time.printCurrentTime();

        System.out.println(time.getClass().getName());
        //输出：javaClassExercise.Time；获取当前调用对象所属的类
        System.out.println(time.getClass().getClassLoader());
        //输出：sun.misc.Launcher$AppClassLoader@20e90906；获取类加载器
        System.out.println(time.getClass().getClassLoader().getClass().getName());
        //输出：sun.misc.Launcher$AppClassLoader；类加载所属类名
    }
}
